package casa.depesos.app.com.http.data;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.NonNull;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class Msg implements Parcelable {
    @SerializedName("hdg")
    @Expose
    public String title;

    @SerializedName("body")
    @Expose
    public String content;

    @SerializedName("alertTmstmp")
    @Expose
    public String time;

    @SerializedName("consume")
    @Expose
    public boolean isRead;

    protected Msg(Parcel in) {
        title = in.readString();
        content = in.readString();
        time = in.readString();
        isRead = in.readByte() != 0;
    }

    public static final Creator<Msg> CREATOR = new Creator<Msg>() {
        @Override
        public Msg createFromParcel(Parcel in) {
            return new Msg(in);
        }

        @Override
        public Msg[] newArray(int size) {
            return new Msg[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(@NonNull Parcel parcel, int i) {
        parcel.writeString(title);
        parcel.writeString(content);
        parcel.writeString(time);
        parcel.writeByte((byte) (isRead ? 1 : 0));
    }
}
